<?php
class MagicMethod1{
    public function __toString(){
        return "这是对象的字符串.<br>\n";
    }
    public function __invoke($num){
        echo "对象当作函数用，传入参数是:{$num} <br>\n";
    }
}

$obj =  new MagicMethod1();
echo $obj;
$obj(123);